package threadDemo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-10-07
 * Time: 21:04
 */
class MyThread extends Thread{
    @Override
    public void run(){
        while(true){
            System.out.println("hello thread!");
            try{
                //休眠1000ms
                Thread.sleep(1000);
            }catch(Exception e){
                e.printStackTrace();
            }
        }
    }
}

class runnable implements Runnable{

    @Override
    public void run() {

    }
}
public class Test {
    public static void main(String[] args) {
        //开启一个进程
        Thread myThread = new MyThread();
        myThread.start();

        while(true){
            System.out.println("hello world!");
            try{
                //休眠1000ms,
                Thread.sleep(1000);
            }catch(Exception e){
                e.printStackTrace();
            }
        }
    }
}
